package com.his.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.his.bean.DzmHisRegistration;
import com.his.mapper.DzmHisRegistrationMapper;
import com.his.service.DzmHisRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
*
*/
@Service
public class DzmHisRegistrationServiceImpl extends ServiceImpl<DzmHisRegistrationMapper, DzmHisRegistration>
implements DzmHisRegistrationService{
//a
    @Autowired
    DzmHisRegistrationMapper dzmHisRegistrationMapper;

    @Override
    public List<Map> reg_cx(DzmHisRegistration dzmhisregistration) {
        return dzmHisRegistrationMapper.reg_cx(dzmhisregistration);
    }


    @Override
    public Boolean reg_xg(DzmHisRegistration dzmhisregistration) {
        int xg= dzmHisRegistrationMapper.reg_xg(dzmhisregistration);
        String registrationNumberss = dzmhisregistration.getRegistrationNumber();
        int tj= dzmHisRegistrationMapper.reg_tj(dzmhisregistration,registrationNumberss);
        if(xg>0 || tj>0){
            System.out.println("添加成功");
            return true;
        }
        return false;
    }

    @Override
    public Boolean reg_tf(DzmHisRegistration dzmhisregistration) {

        int gh=dzmHisRegistrationMapper.reg_tf(dzmhisregistration);
        int sf=dzmHisRegistrationMapper.reg_sf(dzmhisregistration);
        System.out.println("============"+dzmhisregistration+"我的前台传输的退费");
        Map map = dzmHisRegistrationMapper.reg_Id(dzmhisregistration.getRegistrationId());
        System.out.println(map+"map===========================");

        map.put("admMemo",dzmhisregistration.getAdmMemo());
        int tk=dzmHisRegistrationMapper.reg_tk(map);

        if(gh>0 || sf>0){
            System.out.println("添加成功");
            return true;
        }else if(tk>0){
            System.out.println("添加成功");
            return true;
        }
        return false;
    }

    @Override
    public int reg_xgzt(DzmHisRegistration dzmhisregistration) {
        return dzmHisRegistrationMapper.reg_xgzt(dzmhisregistration);
    }




}
